<?php
     include_once('../src/classes/class.mssql.php');
     include_once('../src/classes/class.login.php');
     
     $db = new MSSQL();
     
     session_start();
     $login = new Login();
     
     $comtec_id_user = $login->giveId();     
     
     $consulta = "SELECT DISTINCT m.brand ";
     $consulta.= "FROM (machines as m INNER JOIN mainteiner as ma ON m.comtec_id_mainteiner = ma.comtec_id_mainteiner) INNER JOIN users as u ON u.comtec_id_mainteiner = m.comtec_id_mainteiner "; 
     $consulta.= "WHERE u.comtec_id_user = $comtec_id_user AND m.status_reg = 1";
     $select = $db->query($consulta);
     $resultado = '<option value="null" selected>Selecci&oacute;n...</option>';
     while($s= sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC))
     {
      $brand = $s['brand']; 
      $resultado .="<option value='$brand' >$brand</option>";
     }
     echo $resultado;
?>
